﻿@*<script src="/Scripts/jquery-1.5.1.js" type="text/javascript"></script>*@
@model PInitiatives.ViewModels.VMReviews.VMToReview

@{
    var participatedInitativesToReview = new WebGrid(
        source: Model.ParticipatedInitatives,
        canPage: true, 
        canSort: true,
        rowsPerPage:10,
        defaultSort: "CreateDate",
        ajaxUpdateContainerId: "initativesGrid"
        );

    var createdInitativesToRate = new WebGrid(
        source: Model.CreatedInitatives,
        canPage: true,
        canSort: true,
        rowsPerPage: 10,
        defaultSort: "CreateDate",
        ajaxUpdateContainerId: "initativesGrid2"
        );
}


@{
    ViewBag.Title = "Do oceny";
}

<h3>Do oceny</h3>

</br>
<h4>Iventy w których brałeś udział</h4></br>

@if (Model.ParticipatedInitatives.Count() > 0)
{
    @participatedInitativesToReview.GetHtml(
        htmlAttributes:
            new { id = "initativesGrid" },
            tableStyle: "ini-table-black",
            columns: participatedInitativesToReview.Columns(
                participatedInitativesToReview.Column("Name"),
                participatedInitativesToReview.Column("Description"),
                participatedInitativesToReview.Column(format: (item) => Html.ActionLink("Oceń", "InitiativeReview", new { id = item.ID }))
                )
        ) 
}
else
{
    <p>Oceniłeś wszystkie iventy w których brałeś udział</p>
}

</br>
<h4>Iventy których jesteś autorem</h4></br>
@if (Model.CreatedInitatives.Count() > 0)
{
    @createdInitativesToRate.GetHtml(
        htmlAttributes:
            new { id = "initativesGrid2" },
            tableStyle: "ini-table-black",
            columns: participatedInitativesToReview.Columns(
                participatedInitativesToReview.Column("Name"),
                participatedInitativesToReview.Column("Description"),
                participatedInitativesToReview.Column(format: (item) => Html.ActionLink("Oceń", "UserReview", new { id = item.ID }))
                )
        ) 
}
else
{ 
    <p>Oceniłeś wszystkie iventy w których byłeś autorem</p>
}

@*<table>
    <tr>
        <th>Nazwa</th>
        <th>Opis</th>
    </tr>

@foreach (var item in Model)
{ 
    <tr>
        <td>@Html.DisplayFor(i => item.Name)</td>
        <td>@Html.DisplayFor(i => item.Description)</td>
        <td>@Html.ActionLink("Oceń", "InitiativeReview", new { id=item.ID})</td>
    </tr>
}

</table>*@